package com.endurance.controller;

import com.endurance.context.StateContext;
import com.endurance.service.OrderService;
import com.endurance.service.impl.AlreadySignedOrderState;
import com.endurance.utils.SpringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: sunlin
 * @Date: 2024-05-20 9:55
 * @Version: 1.0
 * @Description:
 */
@RestController
public class StatusController {

    @RequestMapping("/status")
    public String status(String statusBeanId) {

        OrderService bean = SpringUtils.getBean(statusBeanId, OrderService.class);
        StateContext stateContext = new StateContext(bean);
        stateContext.switchState();
        return "success";
    }

}
